﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using StudentInfoSystem.Data;

namespace StudentInfoSystem.View
{
    public partial class AddNewStudentForm : Form
    {
        public AddNewStudentForm()
        {
            InitializeComponent();
            this.domainUpDown.SelectedIndex = 0;
        }

        private void buttonAddStudent_Click(object sender, EventArgs e)
        {
            string fName = textBoxFirstName.Text;
            string mName = textBoxMiddleName.Text;
            string lName = textBoxLastName.Text;
            string faculty = textBoxFaculty.Text;
            string spec = textBoxSpec.Text;
            byte oks = (byte)(comboBoxOKS.SelectedIndex+1);
            byte status = (byte)(comboBoxStatus.SelectedIndex+1);
            string facNumber = textBoxFacNumber.Text;
            byte course = byte.Parse(domainUpDown.SelectedItem.ToString());
            string potok = textBoxPotok.Text;
            int group = int.Parse(textBoxGroup.Text);
            StudentDataAccess.AddStudent(fName, mName, lName, faculty, spec, oks, status, facNumber, course, potok, group);
            MessageBox.Show("Успешно въведохте студента.");
            this.Close();
        }

        private void buttonClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
